<template>
  <div>
    <button @click="add">+</button><span>{{ value }}</span
    ><button @click="reduce">-</button>
  </div>
</template>
<script>
export default {
  props: {
    value: {
      type: Number,
      required: true,
      validator: value => {
        return value >= 0
      }
    }
  },
  methods: {
    add () {
      this.$emit('input', this.value + 1)
    },
    reduce () {
      this.$emit('input', this.value - 1)
    }
  }
}
</script>
<style></style>
